package string.nowcoder.medium;

import java.util.*;

/**
 * @author bruin_du
 * @description 查找兄弟单词
 * @date 2022/7/7 17:57
 **/
public class SearchBrotherWord {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String[] strings = new String[n];
        for (int i = 0; i < n; i++) {
            strings[i] = in.next();
        }
        String target = in.next();
        char[] tArr = target.toCharArray();
        Arrays.sort(tArr);
        String newTarget = new String(tArr);
        int k = in.nextInt();
        List<String> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            if(strings[i].length() == target.length() && !strings[i].equals(target)) {
                char[] arr = strings[i].toCharArray();
                Arrays.sort(arr);
                String newStr = new String(arr);
                if(newStr.equals(newTarget)) {
                    list.add(strings[i]);
                }
            }
        }
        System.out.println(list.size());
        String[] newStrings = list.toArray(new String[0]);
        Arrays.sort(newStrings);
        if(k >=1 && k <= list.size()) {
            System.out.println(newStrings[k - 1]);
        }
    }
}
